package com.kx.demo.concurrent;

/**
 * @author kx
 * @date 2020/4/12
 */
public enum Status {
    NIHK(1, 1),
    OW(2, 3)
    ;

    private int key;
    private int value;

    Status(int key, int value) {
        this.key = key;
        this.value = value;
    }

    @Override
    public String toString() {
        return "Status{" +
                "key=" + key +
                ", value=" + value +
                '}';
    }

    public static Status getByKey(int key) {
        for (Status status : Status.values()) {
            if (key == status.key) {
                return status;
            }
        }
        return null;
    }

    public static void main(String[] args) {
        System.out.println(Status.getByKey(1));
    }

}
